<?php

/**
 * This file is part of the Framework03 PHP framework.
 * @author Walter Tamboer
 * @package Framework03
 */
 
/**
 * @brief The FW_View_Helper_HeadTitle view helper is used to create a title for a webpage.
 */
class FW_View_Helper_HeadTitle extends FW_View_Helper_Abstract
{
	/**
	 * @var string The value of the title to generate.
	 */
	private $title = '';
	
	/**
	 * @brief The entry point of this view helper.
	 * @return FW_View_Helper_HeadTitle
	 */
	public function headTitle()
    {
		return $this;
    }
	
	/**
	 * @brief Sets the value of the title.
	 * @param string $value The value to set the title to.
	 * @return FW_View_Helper_HeadTitle
	 */
	public function set($value)
	{
		$this->title = $value;
		return $this;
	}
	
	/**
	 * @brief Prepends the given value to the title.
	 * @param string $value The value to prepend.
	 * @return FW_View_Helper_HeadTitle
	 */
	public function prepend($value)
	{
		$this->title = $value . $this->title;
		return $this;
	}
	
	/**
	 * @brief Appends the given value to the title.
	 * @param string $value The value to append.
	 * @return FW_View_Helper_HeadTitle
	 */
	public function append($value)
	{
		$this->title = $this->title . $value;
		return $this;
	}
	
	/**
	 * @brief Converts this title to a string value.
	 * @return string
	 */	
	public function __toString()
	{
		return '<title>' . $this->title . '</title>';
	}
}
